<%@page import="twitter4j.conf.ConfigurationBuilder"%>
<%@page import="twitter4j.http.AuthorizationConfiguration"%>
<%@page import="net.sf.ehcache.config.ConfigurationFactory"%>
<%@page import="twitter4j.conf.Configuration"%>
<%@page import="twitter4j.http.AuthorizationFactory"%>
<%@page import="twitter4j.http.Authorization"%>
<%@page import="twitter4j.http.RequestToken"%>
<%@page import="twitter4j.TwitterFactory"%>
<%@page import="twitter4j.TwitterException"%>
<%@page import="twitter4j.http.AccessToken"%>
<%@page import="twitter4j.Twitter"%>
<%@ page language="java" pageEncoding="UTF-8"%><%
	try {
		String CONSUMER_KEY = "SYwJg523pWZPjL32xDMw";
		String CONSUMER_SECRET = "t9vE5tFYE8CCAyJE4i62kWeNG4UywJSwiJmu5ATYI";
			
		String token = (String)session.getAttribute("token");
		String tokenSecret= (String)session.getAttribute("tokenSecret");
		
		Twitter twitter= new TwitterFactory().getOAuthAuthorizedInstance(CONSUMER_KEY, CONSUMER_SECRET, new AccessToken(token,tokenSecret));
		twitter.updateStatus(request.getParameter("tweet"));
		out.println("tweet success.");
	} catch (Exception e) {
		out.println("tweet failure.");
		e.printStackTrace();
	}
	
%>